home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1818 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  46 lines

  1. Path: oxy.rust.net!usenet
  2. From: ebennett@rust.net
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Linker ERROR: BC4 --  HELP!!!
  5. Date: Wed, 17 Jan 1996 05:58:11 GMT
  6. Organization: Rust Net - High Speed Internet in Detroit  810-642-2276
  7. Message-ID: <4dhoij$ioj@oxy.rust.net>
  8. References: <4denut$2k9@lastactionhero.rs.itd.umich.edu>
  9. NNTP-Posting-Host: liv-10.rust.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. mschunde@umich.edu (Mark Schunder) wrote:
  13.  
  14.  
  15. >Here is the error I'm getting when i compile my project under BC4:
  16.  
  17. >Linker Error: _uiKey defined in module KEYBOARD.C is duplicated in
  18. >module MAIN.C
  19.  
  20. >KeybTaskHandle and uiKey are suppose to be global varaibles.  uiKey is
  21. >accessed by two different c files : Keyboard.c (this file updates
  22. >uiKey with the ascii when the user presses a key on the keyboard) and
  23. >main.c (this file monitors uiKey, when it changes, it repaints the
  24. >screen according to the value of uiKey).
  25.  
  26. >I do not know why I'm getting these errors.  I have the keyboard.c
  27. >header file included in both KEYBOARD.c and MAIN.C (so both sets of
  28. >files can see the variable and read and update the variables
  29. >accordingly).  
  30.  
  31. The header file should contain an extern declaration for uiKey and
  32. KeybTaskHandle.  The actual declarations of the variables should be in
  33. one and only one source file.  Assuming uiKey is an int, put the
  34. following statement in the header file:
  35.  
  36.    extern int uiiKey;
  37.  
  38. and the following statement in one and only one source file at file
  39. scope level:
  40.  
  41.   int uiKey;
  42.  
  43. Earl
  44.  
  45.  
  46.